namespace MathTutorPro.Models.Responses
{
    /// <summary>
    /// API 统一响应格式
    /// </summary>
    public class ApiResponse<T>
    {
        /// <summary>
        /// 响应代码
        /// </summary>
        public int Code { get; set; }

        /// <summary>
        /// 响应消息
        /// </summary>
        public string Message { get; set; }

        /// <summary>
        /// 响应数据
        /// </summary>
        public T Data { get; set; }

        public static ApiResponse<T> Success(T data, string message = null)
        {
            return new ApiResponse<T>
            {
                Code = 20000,
                Message = message,
                Data = data
            };
        }

        public static ApiResponse<T> Error(string message)
        {
            return new ApiResponse<T>
            {
                Code = 50000,
                Message = message,
                Data = default
            };
        }
    }

    /// <summary>
    /// 无数据的 API 响应格式
    /// </summary>
    public class ApiResponse
    {
        /// <summary>
        /// 响应代码
        /// </summary>
        public int Code { get; set; }

        /// <summary>
        /// 响应消息
        /// </summary>
        public string Message { get; set; }

        public static ApiResponse Success(string message = null)
        {
            return new ApiResponse
            {
                Code = 20000,
                Message = message
            };
        }

        public static ApiResponse Error(string message)
        {
            return new ApiResponse
            {
                Code = 50000,
                Message = message
            };
        }
    }
} 